package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckGroupPojo;
import com.itheima.pojo.vo.CheckGroupVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CheckgroupMapper {
    /**
     * 添加检查组
     * @param checkGroup
     */
    @Insert("insert into checkgroup (code, name, sex, helpName, price, cost, remark, attention, create_time, update_time) values(#{code},#{name},#{sex},#{helpName},#{price},#{cost},#{remark},#{attention},#{creatTime},#{updateTime})")
    void add(CheckGroup checkGroup);

    /**
     * 删除检查组
     * @param id
     */
    @Delete("delete from checkgroup where id = #{id}")
    void deleteById(Integer id);

    void update(CheckGroup checkGroup);

    /**
     * 分页查询
     * @param queryPageBean
     * @return
     */
    Page<CheckGroupVo> findPage(QueryPageBean queryPageBean);

    /**
     * 查询所有检查组
     * @return
     */
    @Select("select id, code, name, sex, helpName, remark from checkgroup ")
    List<CheckGroupVo> findAll();

    /**
     * 根据id查询检查组
     * @param id
     * @return
     */
    @Select("select id, code, name, sex, helpName, remark from checkgroup where id = #{id}")
    CheckGroupVo getById(Integer id);

    /**
     * 根据检查组id查询检查组
     * @param checkgroupIds
     * @return
     */

    List<CheckGroupVo> ByList(@Param("list") List<Integer> checkgroupIds);

/**
     * 根据检查组id查询检查组
     * @param list
     * @return
     */

    List<CheckGroupPojo> ByListId(List<Integer> list);
}
